/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fatecpg.ads.les.projeto;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 * @author Tailine
 */
public class hash {

    public String criarHash(String pass) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        byte[] bytesOfMessage = pass.getBytes("UTF-8");
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] bytes = md.digest(bytesOfMessage);
        StringBuilder sb = new StringBuilder();
        for (byte b : bytes) {
            sb.append(String.format("%02x", b & 0xff));

        }
        return sb.toString();
    }
}
